#include "ThreadCache.hpp"

void* ThreadCache::FetchFromCentralCache(size_t index,size_t size)
{
    return nullptr;
}
void*ThreadCache::Allocate(size_t size)
{
    assert(size<=MAX_BYTES);
    //对齐大小
    size_t alignSize = SizeClass::RoundUp(size);
    //处于哪一个桶？
    size_t index = SizeClass::Index(size);
    if(!_freeLists[index].Empty())
    {
        return _freeLists[index].Pop();
    }
    else
    { 
        return FetchFromCentralCache(index,alignSize);
    }

}
 